﻿/*
 * BlockBitmapSource
 * 
 * initial implementation : 3.12.2008
 *
 * Copyright (c) Adam Sida, asida@centrum.cz.
 * All rights reserved.
 * 
 * for license see Petra.Gis.License.txt
 */
using System;
using System.IO;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Runtime.InteropServices;

namespace Petra.Gis.ImagingServices.Tiff
{

  public partial class BlockBitmapSource : BitmapSource
  {


    #region create


    //public static BlockBitmapSource Create(TiffReader tiffReader, bool decodeBilevelAs8bpp, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption)
    public static BlockBitmapSource Create(TiffReader tiffReader, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption)
    {

      // try create ifd first
      // from current position
      ImageFileDirectory ifd = ImageFileDirectory.Create(tiffReader);

      // if has ifd then create BlockBitmapSource
      return new BlockBitmapSource(tiffReader, ifd, createOptions, cacheOption);

    }





    //protected static double[] readTransformMatrix(BinaryReader citReader)
    //{
    //  double[] result = new double[16];
    //  for (int i = 0; i < 16; i++)
    //    result[i] = citReader.ReadDouble();

    //  return result;
    //}

    #endregion create


  }
}
